﻿<table class="table table-bordered table-hover table-striped">
    <thead>
        <tr class="info">
            <th  style="width: 60px; padding: 8px 2px;">基层队</th>
            <th style="width: 260px;">工 作 内 容</th>
            <th style="width: 95px;">任务来源</th>
            <th style="width: 80px;">完成情况</th>
            <th>车辆</th>
        </tr>
    </thead>
    <tbody>
    <tr ng-repeat="record in taskRecords" ng-class-even="'success'">
        <td ng-if="$index==0" rowspan="{{taskRecords.length+1}}" class="text-center"><span class="display-text">{{record.team.name}}</span></td>
        <td ng-click="editing(record,'inputContent')" ng-mouseleave="record.inputContent=false">
            <span class="display-text" ng-show="!record.inputContent">{{record.content}}</span>
            <textarea rows="4" ng-show="record.inputContent" class="form-control" ng-model="record.content" ng-blur="updateTaskRecord(record)"></textarea>
        </td>
        <td>
            <select ng-disabled="!canEdit" class="form-control" ng-model="record.source" ng-change="updateTaskRecord(record)" ng-options="source.name for source in taskRecordsResource.taskRecordSources"></select>
        </td>

        <td>
            <select ng-disabled="!canEdit" class="form-control" ng-model="record.status" ng-change="updateTaskRecord(record)" ng-options="status.name for status in taskRecordsResource.taskRecordStatus"></select>
        </td>
        <td ng-click="editing(record,'inputCar')" ng-mouseleave="record.inputCar=false">
            <span class="display-text" ng-show="!record.inputCar">{{record.car}}</span>
            <textarea row="2" ng-show="record.inputCar" class="form-control" ng-model="record.car" ng-blur="updateTaskRecord(record)"></textarea>
        </td>
    </tr>
    <tr ng-if="canEdit" ng-class="{'success':taskRecords.length%2!=0}">
        <td ng-if="taskRecords.length==0" class="text-center"><span class="display-text">{{newTaskRecord.team.name}}</span></td>
        <td><input type="text" class="form-control" ng-model="newTaskRecord.content"></td>
        <td>
            <select class="form-control" ng-model="newTaskRecord.source" ng-change="addNewTaskRecord()" ng-options="source.name for source in taskRecordsResource.taskRecordSources"></select>
        </td>
        <td>
            <select class="form-control" ng-model="newTaskRecord.status" ng-change="addNewTaskRecord()" ng-options="status.name for status  in taskRecordsResource.taskRecordStatus"></select>
        </td>
        <td style="width: 80px"><input class="form-control" ng-model="newTaskRecord.car" ng-blur="addNewTaskRecord()"></td>
    </tr>
    </tbody>

  
</table>


<style>
    .display-text {
        display: inline-block;
        margin-top: 5px;
        word-break: break-all;
    }
</style>